import { defineStore } from 'pinia'

type State = {
  name: string
  age: number
}

export const useCounterStore = defineStore('counter', {
  state: (): State => ({
    name: 'name',
    age: 18
  }),
  getters: {
    doubleCount: (state) => state.age * 2
  },
  actions: {
    increment() {
      this.age++
    }
  }
})

export const useGlobalStore = defineStore('globalData', {
  state: () => ({
    showHeader: false
  }),
  actions: {
    checkShowHeader(value: boolean) {
      this.showHeader = value
    }
  }
})
